package com.hadoop.chapter2;

import java.io.IOException;

import org.apache.hadoop.io.FloatWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

public class MaxTemperatureReduce extends  Reducer<Text,FloatWritable,Text,FloatWritable>{
	@Override
	public void reduce(Text key,Iterable<FloatWritable> values,Context context)
			throws IOException, InterruptedException {
		Float maxValue=Float.MIN_VALUE;
		for(FloatWritable value : values) {
			System.out.println("----------------reduce----------------");
			System.out.println("key:"+key+",value:"+value);
			maxValue=Math.max(maxValue, value.get());
		}
		context.write(key, new FloatWritable(maxValue));
	}
}
